package com.eian.boot.mybatis.core.model;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author alex.meng
 * @createTime 2025-09-04 15:16
 * @description 实体基类
 **/
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
public abstract class BaseEntity implements Serializable {

    @Id(value = "id", keyType = KeyType.Auto)
    private Long id;

    @Column(value = "created_by")
    private Long createdBy;

    @Column(value = "created_at")
    private LocalDateTime createdAt;

    @Column(value = "modified_by")
    private Long modifiedBy;

    @Column(value = "modified_at")
    private LocalDateTime modifiedAt;

    @Column(value = "version_flag", version = true)
    private Integer versionFlag;

    @Column(value = "delete_flag", isLogicDelete = true)
    private Integer deleteFlag;
}
